﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace DemoWinApp
{
    /// <summary>
    /// Auction
    /// </summary>
    public class Auction
    {
        #region ctor.

        public Auction()
        {
            innerObj = new Dictionary<string, object>();
            innerObj.Add("ID", null);
            innerObj.Add("ProductID", null);
            innerObj.Add("Account", null);
            innerObj.Add("Price", null);
            innerObj.Add("LogTime", null);
        }

        public Auction(System.Data.IDataReader dr)
            : this()
        {
            this.ID = Convert.ToInt32(dr["ID"]);
            this.ProductID = Convert.ToInt32(dr["ProductID"]);
            this.Account = Convert.ToString(dr["Account"]);
            this.Price = Convert.ToDecimal(dr["Price"]);
            this.LogTime = Convert.ToDateTime(dr["LogTime"]);
        }

        #endregion

        Dictionary<string, object> innerObj;

        private int iD;
        public int ID
        {
            get { return iD; }
            set
            {
                iD = value;
                innerObj["ID"] = value;
            }
        }

        private int productID;
        public int ProductID
        {
            get { return productID; }
            set
            {
                productID = value;
                innerObj["ProductID"] = value;
            }
        }

        private string account;
        public string Account
        {
            get { return account; }
            set
            {
                account = value;
                innerObj["Account"] = value;
            }
        }

        private decimal price;
        public decimal Price
        {
            get { return price; }
            set
            {
                price = value;
                innerObj["Price"] = value;
            }
        }

        private DateTime logTime;
        public DateTime LogTime
        {
            get { return logTime; }
            set
            {
                logTime = value;
                innerObj["LogTime"] = value;
            }
        }
    }
}